package com.xkdx.caipiao.presistence.flowdetail;
import java.util.ArrayList;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xkdx.caipiao.module.network.AbsModule;

public class FlowDetailModule extends AbsModule {
	public ArrayList<FlowDetailInfo> list;

	@Override
	public void parseData() throws Exception {
		try {
			backJson = (JSONArray) result;
			list = new ArrayList<FlowDetailInfo>();
			for (int i = 0; i < backJson.size(); i++) {
				jsonObj = (JSONObject) backJson.get(i);
				String sortOfAct = jsonObj.getString("Act");
				if (sortOfAct.equals("GetRechargeList")) {
					parseCost(jsonObj.getJSONArray("DetailInfo"));
				}

			}
		} catch (Exception e) {
			throw e;
		}

	}

	private void parseCost(JSONArray jsonArray) throws Exception {
		try {

			JSONArray array = jsonArray;
			for (int i = 0; i < array.size(); i++) {
				JSONObject obj = array.getJSONObject(i);
				FlowDetailInfo flowinfo = new FlowDetailInfo();
				flowinfo.setId(obj.getString("id"));
				flowinfo.setUid(obj.getString("uid"));
				flowinfo.setCtime(obj.getString("ctime"));
				flowinfo.setPtime(obj.getString("ptime"));
				flowinfo.setMobileno(obj.getString("mobileno"));
				flowinfo.setResponseid(obj.getString("responseid"));
				flowinfo.setProid(obj.getString("proid"));
				flowinfo.setAmount(obj.getString("amount"));
				flowinfo.setFlow(obj.getString("flow"));
				flowinfo.setRegion(obj.getString("region"));
				flowinfo.setOrderid(obj.getString("orderid"));
				flowinfo.setSuccess_time(obj.getString("success_time"));
				flowinfo.setIspay(obj.getString("ispay"));
				flowinfo.setIssurepay(obj.getString("issurepay"));
				flowinfo.setDevicetype(obj.getString("devicetype"));
				flowinfo.setTradestatus(obj.getString("tradestatus"));
				flowinfo.setState(obj.getString("state"));
				list.add(flowinfo);
			}

		} catch (Exception e) {

			throw e;
		}
	}
}
